<template>
  <div class="blogHeader-box">
    <div class="blog-header flex-row">
      <div class="header-left flex-row">
        <div class="title">
          {{blogTitle}}
        </div>
        <div class="tag-box flex-row ml20 flex-h-center">
          <ul class="flex-row">
            <li v-for="item in tags" :key="item.id" :style="{background: item.color}">{{item.name}}</li>
          </ul>
        </div>
      </div>
      <div class="header-right flex-row cp" @click="goHome">
        <div>
          <i class="el-icon-back"></i>
        </div>
        <div class="title">返回</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BlogHeader',
  props: {
    blogTitle: {
      required: true,
      type: String
    },
    tags: {
      required: true,
      type: Array
    }
  },
  methods: {
    goHome() {
      this.$router.push({ name: 'home' })
    }
  }
}
</script>

<style scoped lang="less">
.blogHeader-box{
  .blog-header{
    color: #849aa4;
    padding: 0 50px;
    padding-right: 70px;
    justify-content: space-between;
    height: 50px;
    line-height: 50px;
    background:#f9fafc;
    .header-left{
      .title{
        font-size:22px;
        color: #4b595f;
      }
      .tag-box{
        ul{
          align-items: center;
          li{
            float: left;
            margin-right: 4px;
            height: 26px;
            font-size: 12px;
            line-height: 26px;
            padding: 0 12px;
            color: #fff;
            border-radius: 4px;
          }
        }
      }
    }
    .header-right{
      i{
        font-size: 20px;
        line-height: 50px;
      }
      .title{
        margin-left: 6px;
        font-size:14px;
        color: #4b595f;
      }
      &:hover{
        i,.title{
          color: #3593f2;
        }
      }
    }
  }
}

</style>